﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace eventModel
{
    // Dave- I think this logging class could benefit from your memory-managed Factory class for 
    // long entry instantiation, since the server would most likely constantly add new entries to
    // the log list within memory and then flush them to a file/db and add more
    public class LogEntry
    {
        public DateTime TimeStamp { get; set; }
        public string Message { get; set; }
    }

    public static class Logging
    {
        public static List<LogEntry> Entries { get; set; }
        static Logging() { Entries = new List<LogEntry>(); }

        public static void Add(string Message)
        {
            Entries.Add(new LogEntry { TimeStamp = DateTime.Now, Message = Message });
            if (Entries.Count > 50) { Entries.RemoveRange(0, Entries.Count - 40); }
        }
    }
}
